#
# ICD AS (C) 2007 - MAKEFILE CREATED USING CDP MAKEFILE WIZARD
#
# Make sure that the environment variable CDPBase exists. This can
# be carried out by typing echo $CDPBase at the command promt, where
# the Makefile should be run by make. Note that the Makefile Wizard
# is created for the purpose of CDP Projects. It is, however, fully
# possible to use it for other project types as well.
#
# - To add a profiler in your executable, compile and link with, -pg.
# - To open/use shared libs at runtime, compile -rdynamic and link -ldl.
# - Make sure that a valid CDPLicense.key resides in $CDPBase/License.
# - Run CDP executables as root.


ifndef CFG
CFG=Debug
endif

ifndef COMPILER
COMPILER=g++
endif

ifndef AR
AR=ar
endif

ifndef ARFLAGS
ARFLAGS=rcs
endif

ifeq "$(CFG)" "Release"
CFLAGS=  -D_UNICODE -W -O2 -fno-inline  -mcpu=pentiumpro -D_M_IX86=500 -fexceptions -D_THREAD_SAFE -D_LINUX  -DNDEBUG -D_LIB
ILFLAGS= -I -L../../homebase/linux/
TARGET= ../../homebase/linux/liboogetopt.a
endif

ifeq "$(CFG)" "Debug"
CFLAGS= -g -D_UNICODE -O0 -Wall -fno-inline  -mcpu=pentiumpro -D_M_IX86=500 -fexceptions -D_THREAD_SAFE -D_LINUX  -D_DEBUG -D_LIB -D_CRT_SECURE_NO_WARNINGS
ILFLAGS= -I../ark -I../backpack/ammo -I../scuba -L../../homebase/linux/
TARGET= ../../homebase/linux/liboogetopt.a
endif

SOURCE_FILES=  $(wildcard *.cpp)

OBJS=$(patsubst %.cpp, %.o,$(SOURCE_FILES))

.PHONY:all
all: $(TARGET)

$(TARGET): $(OBJS)
	$(AR) $(ARFLAGS) $@ $(OBJS)

%.o: %.cpp
	$(COMPILER) $(CFLAGS) $(ILFLAGS) $(GLOBALS) -o $@ -c $<

.PHONY:clean
clean:
	 -rm -f $(OBJS) $(TARGET)

